package org.zp.service;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zp.mapper.UserInfoMapper;
import org.zp.pojo.UserInfo;
import org.zp.pojo.UserOldInfo;
import org.zp.util.MyBatisUtil;

import com.github.pagehelper.PageHelper;
@Service
@Transactional(rollbackFor = Exception.class)//出现异常就回滚事务
public class UserInfoServiceImpl implements UserInfoService{
@Resource
private UserInfoMapper u;

	@Override
	public List<UserInfo> showGKuser() {

		return u.selectByUser();
	}

	@Override
	public List<UserInfo> selectuser(Integer startpage, Integer limitpage, String name, Long sex, String strart, String end) {
		PageHelper.startPage(startpage, limitpage);
		return u.selectUserinfo(name, sex, strart, end);
	}

	@Override
	public Integer updateUserState(int uid, int iStatus) {

		return u.updateUserState(uid, iStatus);
	}

	@Override
	public Integer deleteUser(int uid) {

		return u.deleteUser(uid);
	}

	@Override
	public Integer newUserpwd(int uid,String pwd) {

		return u.newpwd(uid,pwd);
	}

	@Override
	public UserInfo getUserByid(int uid) {
		
		return u.getUserByid(uid);
	}

	@Override
	public Integer updateUserScore(Integer newScore,int uid) {
		
		return u.useraddMoney(newScore,uid);
	}

	@Override
	public UserOldInfo selectbyuideid(Integer uid, Integer eid) {
		// TODO Auto-generated method stub
		return u.selectbyuideid(uid,eid);
	}

}
